#
# Copyright (c) CERN 2013-2015
#
# Copyright (c) Members of the EMI Collaboration. 2010-2013
#  See  http://www.eu-emi.eu/partners for details on the copyright
#  holders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

cmake_minimum_required(VERSION 2.8)

find_package (GLOBUS)
include_directories (${GLOBUS_INCLUDE_DIRS})

set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Disable "-Wregister" warning generated by Globus library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-register")

set(fts_proxy_SOURCES CredUtility.cpp DelegCred.cpp TempFile.cpp)
add_library(fts_proxy SHARED ${fts_proxy_SOURCES})
target_link_libraries(fts_proxy
    fts_common
    fts_db_generic
    ${CMAKE_THREAD_LIBS_INIT}
    globus_common
    globus_gsi_credential
    vomsapi
)

set_target_properties(fts_proxy PROPERTIES
    LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/src/cred
    VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
    SOVERSION ${VERSION_MAJOR}
    CLEAN_DIRECT_OUTPUT 1
)

# Artifacts
install(TARGETS fts_proxy 
	RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} 
	LIBRARY DESTINATION ${LIB_INSTALL_DIR}
)
